<template>
  <div class="home-sale-card">
    <div class="sale-card-header">
      <span class="title">助手</span>

    </div>
    <div class="assistant-card-content">
      <el-scrollbar class="" style="height:278px">
        <NoData v-if="List1.length<=0&&List2.length<=0" height="40" />
        <div v-for="l in List1" :key="l.id" class="card-item">
          <img src="@/assets/images/icon-app-clue.png">
          <div class="card-item-row">
            <span class="card-item-title">今天为你分配的线索</span>
            <span class="card-item-name app-link" @click="gotoMainPage('clue/info',{id:l.id})">
              {{ l.companyName }}
            </span>
          </div>
        </div>
        <div v-for="l in List2" :key="l.id" class="card-item">
          <img src="@/assets/images/icon-app-chance.png">
          <div class="card-item-row">
            <span class="card-item-title">本周的活动</span>
            <span class="card-item-name app-link" @click="gotoMainPage('chance/info',{id:l.id})">{{ l.name }}</span>
          </div>
        </div>
      </el-scrollbar>
    </div>

  </div>
</template>
<script>
import { dateTypes } from '@/utils/enums'
import { getClueList } from '@/api/clue'
import { getChanceList } from '@/api/chance'
import dayjs from 'dayjs'

export default {
  name: 'SaleCard',
  data() {
    return {
      dateTypes,
      date: 7,
      List1: [],
      List2: []
    }
  },
  mounted() {
    const owner = this.USER.userName || ''
    getClueList({ searchStatus: 1, currentPage: 1, pageSize: 10, owner }).then(res => {
      this.List1 = res.records || []
    })
    const date = {
      startBusEndDate: dayjs().startOf('week').format('YYYY-MM-DD HH:mm:ss'),
      endBusEndDate: dayjs().endOf('week').format('YYYY-MM-DD HH:mm:ss')

    }
    getChanceList({ currentPage: 1, pageSize: 10, owner, ...date }).then(res => {
      this.List2 = res.records || []
    })
  },
  methods: {

  }
}
</script>
